﻿using RuoVea.Entity;
using Mapster;
using SqlSugar;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.Extensions.DependencyInjection;
using RuoVea.Autowired;
using RuoVea.ExSqlSugar;

using RuoVea.ExIdGen;
using Microsoft.AspNetCore.Mvc;
using RuoVea.Service;
using RuoVea.ExEnum;
using RuoVea.Util;

namespace RuoVea.Api.Controllers
{
    /// <summary>
    /// 访问日志服务
    /// </summary>
    public class SysVisLogController : ApiBaseController
    {
        private readonly ISysVisLogService _sysVisLogService;

        /// <summary>
        /// 
        /// </summary>
        /// <param name="sysVisLogService"></param>
        public SysVisLogController(ISysVisLogService sysVisLogService)
        {
            _sysVisLogService = sysVisLogService;
        }

        /// <summary>
        /// 分页查询访问日志
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        [HttpGet("page")]
        public async Task<dynamic> QueryVisLogPageList([FromQuery] VisLogInput input)
        {
            return _sysVisLogService.QueryVisLogPageList(input);
        }

        /// <summary>
        /// 清空访问日志
        /// </summary>
        /// <returns></returns>
        [HttpPost("delete")]
        public async Task ClearVisLog()
        {
           await   _sysVisLogService.ClearVisLog( );
        }
    }
}
